package com.heima.utils.thread;

import com.heima.model.user.pojos.ApUserRealname;

/**
 * @author 黄晏凯
 */
public class UserThreadLocalUtil {

    private final static ThreadLocal<ApUserRealname> USER_USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 添加用户
     *
     * @param apUserRealname wm用户
     */
    public static void setUser(ApUserRealname apUserRealname) {
        USER_USER_THREAD_LOCAL.set(apUserRealname);
    }

    /**
     * 获取用户
     */
    public static ApUserRealname getUser() {
        return USER_USER_THREAD_LOCAL.get();
    }

    /**
     * 清理用户
     */
    public static void clear() {
        USER_USER_THREAD_LOCAL.remove();
    }
}